<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../babel.min.js"></script>
    <script src="../react.development.js"></script>
    <script src="../react-dom.development.js"></script>
</head>

<body>

    <div id="root"></div>
    <script type="text/babel">
        class EasyForm extends React.Component {
            constructor(props) {
                super(props)
                this.state = { value: "" }
            }

            handleSubmit(e) {
                e.preventDefault()
                alert(this.state.value)
            }

            handleOnChange(e) {
                e.preventDefault()
                this.setState({ value: e.target.value })
            }

            render() {
                return <div>
                    <form onSubmit={(e) => this.handleSubmit(e)}>
                        <label>Name:
                            <input type="text" value={this.state.value} onChange={(e) => this.handleOnChange(e)} />
                        </label>
                        <input name="submitX" type="submit" />
                    </form>
                    <h1>{this.state.value == "" ? 'none' : this.state.value}</h1>
                </div>

            }
        }

        ReactDOM.render(<EasyForm />, document.getElementById("root"))
    </script>

</body>

</html>